import Device from './device/index';
import Interface from './interface/index';
import GlobalData from './globalData/index';
import Vue from 'vue';

Vue.component(Device.name, Device);
Vue.component(Interface.name, Interface);
Vue.component(GlobalData.name, GlobalData);

const list = [Device, Interface, GlobalData];
const map = list.reduce((prev, current) => {
  prev[current.name] = current;
  return prev;
}, {});

export default {
  list: list,
  map: map,
  getLoaderByName(name) {
    if (map[name] && map[name]['dataLoader']) {
      return map[name]['dataLoader'];
    }
    return null;
  },

}
